#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: KevinQi
@file: redis_handle.py
@time: 2023/12/27 1:08
@desc:
"""

from tornado.escape import json_encode, utf8


class JsonUtils(object):
    @staticmethod
    def success(response):
        """
        正确返回
        :param response: 返回结果
        :return: string, {"message": "ok", "sta": "00", "data": }
        """
        return json_encode({"message": "ok", "sta": "00", "data": response})

    @staticmethod
    def info(message):
        """
        提示返回
        :param message: 提示信息
        :return: string,
        """
        return json_encode({"message": str(message), "sta": "99001", "data": None})

    @staticmethod
    def error(message):
        """
        错误返回
        :param message: 错误信息
        :return: string,
        """
        return json_encode({"message": str(message), "sta": "9999", "data": None})

    @staticmethod
    def noAuth(message):
        """
        无权限返回
        :param message: 错误信息
        :return: string,
        """
        return json_encode({"message": str(message), "sta": "403", "data": None})

